#!/user/bin/env node

const fs = require('fs'),
      sfile = process.argv[2],
      dfile = process.argv[3];

if(!fs.statSync(sfile).isFile()){
  console.error(`${sfile} is not file`);
}

let stm = fs.createReadStream(sfile).pipe(fs.createWriteStream(dfile));

stm.on('close',()=>{
  fs.chmodSync(dfile,fs.statSync(sfile).mode);
})
